<?php include('checkuser.php') ?>

<h1>Welcome Back, <?php echo $profile["FIRST_NAME"]; ?>!</h1>
<form action="index.php" method="POST"><div id="logout"><input type="submit" value="Logout" /></div></form>
<div id="container">
<div id="inner">

<!-- Create sections for each individual user in the database -->
<?php 
// create query to get all profiles
$str = "SELECT * FROM profiles";

// sanitize the query for the database
$str = $db->real_escape_string($str);

// run the query
$result = $db->query($str);

// in a loop, generate sections for each profile
while( $r = $result->fetch_assoc() ) {

	$sec  = "<section>";
	$sec .= "<a href='profile.php?user=".$r['USERNAME']."&requester=".$profile['USERNAME']."'>";
	$sec .= "<img src='img/".$r['USERNAME'].".jpg'/></a>";
	$sec .= "<h3>".$r['FIRST_NAME']." ".$r['LAST_NAME']."</h3>";
	$sec .= "</section>";
	echo $sec;
	
}
?>

</div>
</div>
<div class="clear"></div>
</body>
</html>